package com.example.demo.service.impl;

import com.example.demo.api.dto.EmployeeDTO;
import com.example.demo.domain.entity.Employee;
import com.example.demo.domain.repository.EmployeeRepository;
import com.example.demo.service.EmployeeService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImpl implements EmployeeService {
    private final EmployeeRepository employeeRepository;

    public EmployeeServiceImpl(EmployeeRepository employeeRepository) {
        this.employeeRepository = employeeRepository;
    }

    @Override
    public List<Employee> findEmployeeByCondition(EmployeeDTO employeeDTO) {
        return employeeRepository.findEmployeeByCondition(employeeDTO);
    }

    @Override
    public Employee findEmployeeById(Long employeeId) {
        return employeeRepository.findEmployeeById(employeeId);
    }

    @Override
    public Integer countEmployeeLen() {
        return employeeRepository.countEmployeeLen();
    }

    @Override
    public Integer insertEmployee(EmployeeDTO employeeDTO) {
        return employeeRepository.insertEmployee(employeeDTO);
    }

    @Override
    public Integer removeEmployee(Long employeeId) {
        return employeeRepository.removeEmployee(employeeId);
    }

    @Override
    public Integer updateEmployee(EmployeeDTO employeeDTO) {
        return employeeRepository.updateEmployee(employeeDTO);
    }
}
